<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no">
		<title>H5幸运大转盘抽奖</title>
		<link href="/css/activity-style.css" rel="stylesheet" type="text/css">
	</head>

	<body class="activity-lottery-winning">
		<div class="main">
			<div id="outercont">
				<div id="outer-cont">
					<div id="outer">
						<img src="/images/activity-lottery-1.png" width=310>
					</div>
				</div>
				<div id="inner-cont">
					<div id="inner">
						<img src="/images/activity-lottery-2.png">
					</div>
				</div>
			</div>
			<div class="content">
				<div class="boxcontent boxyellow" id="result" style="display:none">
					<div class="box">
						<div class="title-orange"><span>恭喜你中奖了</span>
						</div>
						<div class="Detail">
							<a class="ui-link" href="http://www.weixinjia.net/mobile/showresult.html" id="opendialog" style="display: none;" data-rel="dialog"></a>
							<p>你中了：<span class="red" id="prizetype">一等奖</span>
							</p>
							<p>你的兑奖SN码：<span class="red" id="sncode"></span>
							</p>
							<p class="red">本次兑奖码已经关联你的微信号，你可向公众号发送 兑奖 进行查询!</p>

							<p>
								<input name="" class="px" id="tel" type="text" placeholder="输入您的手机号码">
							</p>
							<p>
								<input class="pxbtn" id="save-btn" name="提 交" type="button" value="提 交">
							</p>
						</div>
					</div>
				</div>
				<div class="boxcontent boxyellow">
					<div class="box">
						<div style="font-size:15px;"><span>奖项设置：</span>
						</div>	
						<div class="Detail">
							<#if result.data??>
							<#list result.data as w>
							<#if w.count??>
							<p>${w.name}&nbsp;&nbsp;<span style="color:red;">(${w.count}名)</span> </p>
							</#if>
							</#list>
							</#if>
						</div>
					</div>
				</div>
				<!-- <div class="boxcontent boxyellow">
					<div class="box">
						<div class="title-green">活动说明：</div>
						<div class="Detail">
							<p>本次活动每人可以转 3 次 </p>
							<p>我们的中奖率高达33.3%！！ </p>
						</div>
					</div>
				</div> -->
				<div id="awardlog" style="margin:0 auto;line-height:40px;width:100px;text-align:center;font-size:18px;background-color:#ff6501;color:white;border-radius:2;border-radius: 8px;">抽奖纪录</div>
			</div>
			

		</div>
		<script src="/assets/js/jquery-2.0.3.min.js" type="text/javascript"></script>
		<script src="/js/jQueryRotate.2.2.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/layer.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			$(function() {
				var rotating = false;
				var rotateFunc = function(num, msg) {
					rotating = true;
					$("#outer").rotate({
						angle: 0,
						duration: 4000,
						animateTo: num + 1440, //1440是我要让指针旋转4圈
						callback: function() {
							rotating = false;
							  //提示
							 layer.open({ content: msg,btn: '我知道了'});
							
						}
					});
				};
				$("#inner").on("click", function() {
					/***
					 * ajax操作返回数据*
					 * **/
					 $.post("/lottery/award",function(result){
						 if(result.status=="1"){
						 	!rotating && rotateFunc(result.data.angle, result.data.msg);
						 }else{
							 //信息框
							  layer.open({ content: result.msg ,btn: '我知道了'});
						 }
					 });
				});
				$("#index").on("click",function(){
					//location.href="/lottery/index";
				});
				$("#awardlog").on("click",function(){
					$.post("/lottery/awardLog",function(result){
						  var html = [];
						  if(result.data==null){
							  html.push("很遗憾，您还没有抽奖");
						  }else{
							  html.push("您参加了本次抽奖！抽奖纪录如下：</br>")
							  for(var i=0;i<result.data.length;i++){
								  var r = result.data[i];
								  html.push("<span style='color:red;'>"+r.awardName+"</span>"+"&nbsp;&nbsp;&nbsp;"+r.time+"</br>");
							  }
						  }
						  
						 //信息框
						  layer.open({
						    content: html.join("")
						    ,btn: '我知道了'
						  });
					});
				});
			});

			function getRandom(min, max) {
				//x上限，y下限   
				var x = max;
				var y = min;
				if (x < y) {
					x = min;
					y = max;
				}
				var rand = parseInt(Math.random() * (x - y + 1) + y);
				return rand;
			}

		</script>

	</body>

</html>